| Visual Basic (Declaration) | |
|---|---|
Public Overloads Function Read( _ ByVal buffer() As Byte, _ ByVal delimiter() As Byte, _ ByRef found As Boolean _ ) As Integer | |
| Visual Basic (Usage) | Copy Code |
|---|---|
Dim instance As SegmentedStream Dim buffer() As Byte Dim delimiter() As Byte Dim found As Boolean Dim value As Integer value = instance.Read(buffer, delimiter, found) | |
| C++/CLI | |
|---|---|
public: int Read( array<byte>^ buffer, array<byte>^ delimiter, bool% found ) | |
Parameters
- buffer
- The storage location for the received data.
- delimiter
- The token that is used to determine a segment was read.
- found
- True if delimiter is found; false otherwise.
Return Value
The total number of bytes read into the buffer, which will normally be less than buffer.length. Returns 0 if end of stream is reached and there is no data left to return.| Exception | Description |
|---|---|
| System.IO.IOException | Thrown when the stream is not readable. |
| System.ArgumentNullException | Thrown when the receiving buffer is null. |
| System.ArgumentOutOfRangeException | Thrown when the offset is less than zero or when count is less than or equal to zero. |
| System.ArgumentException | Thrown when (offset + count) > buffer.Length. |
| System.IO.EndOfStreamException | At least one byte was read without finding the delimiter before end of stream was reached. |
This method reads from the stream and returns when the provided delimiter is found, buffer.length bytes have been read, or end of stream is reached.
The purpose of this method is to provide a convenient way to read a variable-length record from the stream. This is the only kind of Read that uses internal buffering.
Target Platforms: Microsoft .NET Framework 2.0